<% function outputLeaf(obj) { %>
  <li class="file">
    <% if(!obj.leaf) { %>
    <a href="#<%=obj.name %>/<%=obj.class %>"
      title="<%=obj.file %>"><%=obj.class %></a>
    <% makeTree(obj.children) } %>
    <% if(obj.leaf) { %>
    <a href="#<%=(obj.method + obj.URI) %>"
        title="<%=(obj.method +" " + obj.URI) %>" ><%=obj.name %></a>
    <% } %>
  </li>
<% } %>
<% function outputBrunch(obj) { %>
  <li>
    <% if(obj.class) { %>
      <label for="folder-<%=obj.name %>"><%=obj.class %></label>
      <input type="checkbox" id="folder-<%=obj.name %>">
    <% } else { %>
      <label for="file-<%=obj.name %>"><%=obj.name %></label>
      <input type="checkbox" id="file-<%=obj.name %>">
    <% } %>
      <% makeTree(obj.children) %>
  </li>
<% } %>
<% function makeTree(dataList) { %>
  <ol class="tree">
  <% for(var i=0; i < dataList.length; i++) {
    var obj = dataList[i];
    if(obj.leaf) {
      outputLeaf(obj);
    } else {
      outputBrunch(obj);
    }
  } %>
  </ol>
<% } %>
<%
  ///
%>
<% function printFile(obj) { %>
    <!-- The file -->
    <% if(obj.class) { %>
    <h2 id="<%=obj.name %>/<%=obj.class %>"
      title="<%=obj.file %>"><%=obj.name %>/<%=obj.class %></h2>
    <% }
      makeContent(obj.children);
    %>
    <!-- /The file -->
<% } %>
<% function printRoute(obj, i, o, p, q) { %>
    <!-- Route -->
    <p id="<%=(obj.method + obj.URI) %>">
      <b><%=obj.name %></b> <code><tt><%=obj.method %></tt> <%=obj.URI %></code> <br/>
      <%-obj.desc %>
      <ul>
        <% if(obj.params && obj.params.length > 0) { %>
        <!-- Params -->
          <li>
            <tt>@params：</tt>
            <ol>
              <% for(i=0; o=obj.params[i], i<obj.params.length; i++) { %> 
                <li>
                  <b><%=o.arg %></b> <%=o.desc %>
                </li>
              <% } %>
            </ol>
          </li>
        <% } %>

        <% if(obj.meta) { %>
        <!-- Meta info -->
          <% for(o in obj.meta) { %>
            <% if(obj.meta[o] instanceof Array) { %>
              <li>
                <tt>@<%=o %>：</tt>
                <ol>
                  <% for(p=0; q=obj.meta[o][p], p<obj.meta[o].length; p++) { %>
                    <li>
                      <%=q %>
                    </li>
                  <% } %>
                </ol>
              </li>
            <% } else { %>
              <li>
                <tt>@<%=o %>：</tt> <%=obj.meta[o] %>
              </li>
            <% } %>
          <% } %>
        <% } %>

        <% if(obj.return) { %>
        <!-- Return -->
        <li>
          <tt>@return：</tt> <%=obj.return %>
        </li>
        <% } %>
      </ul>
    </p>
<pre>
<%=obj.fnDef %>
</pre>
    <!--/Route -->
<% } //funcDef() %>
<% function makeContent(dataList) { %>
  <% for(var i=0; i < dataList.length; i++) {
    var obj = dataList[i];
    if(obj.leaf) {
      printRoute(obj);
    } else {
      printFile(obj);
    }
  } %>
<% } %>
<!DOCTYPE HTML>
<html>
<head>
  <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
  <meta http-equiv="X-UA-Compatible" content="chrome=1" />
  <meta name="viewport" content="width=device-width">
  <link rel="canonical" href="http://github.com/ijse/FED" />
  <link rel="icon" href="favicon.ico" />
  <style type="text/css">
  body{font-size:14px;line-height:22px;font-family:Helvetica Neue,Helvetica,Arial;background:#f4f4f4}.interface{font-family:"Lucida Grande","Lucida Sans Unicode",Helvetica,Arial,sans-serif!important}div#sidebar{background:#fff;position:fixed;z-index:10;top:0;left:0;bottom:0;width:200px;overflow-y:auto;overflow-x:hidden;padding:15px 0 30px 30px;border-right:1px solid #bbb;box-shadow:0 0 20px #ccc;-webkit-box-shadow:0 0 20px #ccc;-moz-box-shadow:0 0 20px #ccc}a.toc_title,a.toc_title:visited{display:block;color:#000;font-weight:700;margin-top:15px}a.toc_title:hover{text-decoration:underline}#sidebar .version{font-size:10px;font-weight:400}ul.toc_section{font-size:11px;line-height:14px;margin:5px 0 0;padding-left:0;list-style-type:none;font-family:Lucida Grande}.toc_section li{cursor:pointer;margin:0 0 3px}.toc_section li a{text-decoration:none;color:#000}.toc_section li a:hover{text-decoration:underline}div.container{position:relative;width:550px;margin:40px 0 50px 260px}img#logo{width:450px;height:80px}div.run{position:absolute;right:15px;width:26px;height:18px}div.run:active{background-position:-51px 0}p,div.container ul{margin:25px 0;width:550px}p.warning{font-size:12px;line-height:18px;font-style:italic}div.container ul{list-style:circle;padding-left:15px;font-size:13px;line-height:18px}div.container ul li{margin-bottom:10px}div.container ul.small{font-size:12px}a,a:visited{color:#444}a:active,a:hover{color:#000}a img{border:0}h1,h2,h3,h4,h5,h6{padding-top:20px}h2{font-size:22px}b.header{font-size:18px;line-height:35px}span.alias{font-size:14px;font-style:italic;margin-left:20px}table{margin:15px 0 0;padding:0}tr,td{margin:0;padding:0}td{padding:0 15px 5px 0}table .rule{height:1px;background:#ccc;margin:5px 0}code,pre,tt{font-family:Monaco,Consolas,"Lucida Console",monospace;font-size:12px;line-height:18px;font-style:normal}tt{padding:0 3px;background:#fff;border:1px solid #ddd;zoom:1}code{margin-left:20px}pre{font-size:12px;padding:2px 0 2px 15px;border:4px solid #bbb;border-top:0;border-bottom:0;margin:0 0 25px}img.example_image{margin:0 auto}img.example_retina{margin:20px;box-shadow:0 8px 15px rgba(0,0,0,0.4)}ol.tree{padding:0;font-size:12px}ol.tree li{position:relative;margin-left:-15px;list-style:none}ol.tree li.file{margin-left:-1px!important}ol.tree li.file a{background:url('data:img/jpg;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAYdJREFUeNqMksFqwkAQhmc3W4q0OSq09170LdJzb32IvkQVpIeeS6Gehdz6AkUoePOYe71VEBGiVkUxyaYzY9bENIYuTDbZ3f/b+Wci7ptNoCGEuMPpCsrHp9Z6qKMI4jjmBWVecL7utlqdHW4GFFpDhHtm3/M86PZ6D3QXxpchSqIlITSJgoBjt93CZr2G1WoFy+WS5/d2u4PnblF3YwAqQnEyBKElPs8sK006DCFEsO/78Oq64NTrby+u+4g7TwzQKUCSWDIG/kAcx2E7tm3Dh+fNDhmE2QwygCIIZcKvaDe1gBt5C9mRh9AlqCkE7C1ICZDcVASx9gCZWsgADhmUQCycwxMArgHXYZ9PIcTC9fDIAvY8nwHJTkHYQhCcsEAZYKvKIIJrmbGwGI/holo96oIugdC6sbCeTkEO+33wRyP6bVVSCD5kYOabumPW6SxpSEsXVL4Hg9piNjvPVPMgoKJRKCygUoq7QGdJQ1q6tYJR+5lM5peNxjP8Y+jNZk4aKsevAAMAmFzedjV8x2YAAAAASUVORK5CYII=') 0 0 no-repeat;padding-left:21px;text-decoration:none;display:block}ol.tree li input{position:absolute;left:0;margin-left:0;opacity:0;z-index:2;cursor:pointer;height:1em;width:1em;top:0}ol.tree li input+ol{background:url('data:img/jpg;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAURJREFUeNpi/P//PwMlgImBQkCxASwwRlLLKwYmJqZgRkbGbiBXEYva+0Dvlv7792/tvBoxTAO+fv0MororE6UU9VU5MHRfvP1DsX3+M5DhaxkYxDC98ObNGxBW1FVmY/j16xcYu6SdYvjw4QPDixcvGGSEvoLlQeqweuHdu7dg+vfv32D85ctXsNijR4/B4hwcnHA1WA348uUbmP779y+DUchOuIKQsltgetsUE7garAb8/w9h/vz5h+H0Sk8w2yRsN8OZVa5g9ocPn+BqsBrAzs4PdQEzw48ff+Fi375B2Gxs3HA1WNPB45NlDNzcIvfPXv8LVMwJxmdWOcDZF2//A8uD1GF1wefXZ8Q+Pt42oWN+VBED41d5DKv+/30IlJ8IVCcF5D2DCTPC8gIwAXEDKT4Qk0Di+wzU8xnDgKGbmQACDAAtTZadqmiADQAAAABJRU5ErkJggg==') 40px 0 no-repeat;margin:-18px 0 0 -44px;height:1em}ol.tree li input+ol>li{display:none;margin-left:-14px!important;padding-left:1px}ol.tree li label{background:url('data:img/jpg;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAATNJREFUeNqkk71KA1EQhc/dOxsbEYukVYm9jQg+hz6CYGkrBNsEKwtrX0EfwU4UVFDLFWSDlYGAGszP3p91ZlNpdoVrBg572bnf2ZlhR+V5jnmCbo9VZTJS2ODHbkX63Od4Ij7ssdbKbvAFbB76o2GWYTAe42sywX7aQL8/xNnjYsRXttR1G+3tg4tW7twPWGmNXvJcnBvrzRlzyd+c7nTIeWjPXxD9jjqDb0mC9O6+tAdhpwbWQDTTwsCgvrpSCksFr1dsYAsDC1diUETFe11bgC0qcCBnMoiCQikIS9ZxBcawgQnkIwgrBiT9h1YQRYUBkfFTA2/DKvA8RGGJ5xf/OcSK0JogLH2MsCS/VKzjsBZYwtJDiu7nSevyP4v00kNXNqnGWpbFCuQt613Nu87fAgwAb3KTD1NdyNYAAAAASUVORK5CYII=') 15px 1px no-repeat;cursor:pointer;display:block;padding-left:37px}ol.tree li input:checked+ol{background:url('data:img/jpg;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAASxJREFUeNpi/P//PwMlgImBQkCxASwwRlLLKwYmJqZgRkbGbiBXEYva+0Dvlv7792/tvBoxTAO+fv0MororE6UU9VU5MHRfvP1DsX3+M5DhaxkYsBjw5s0bEKWoq6zA8OvXL7AYKIC/f//O8OPHDwYZIVaQGqjLlDENePfuLZj+/fs3GH/58pXh/fv3YDYIcHBwwtVgDYMvX76B6b9//zIYhezEULhtiglcDVYD/v+HMH/+/MNweqUnhsIPHz7B1WA1gJ2dH+oCZqCf/2IoZGPjhqvBmg4enyxj4OYWuX/2+l+gYk4MfPH2P7A8SB1WF3x+fUbs4+NtEzrmRxUxMH6Vx7Dq/9+HQPmJQHVSQN4zmDAjLC8AExA3kOIDMQkkvs9APZ8xDBi6mQkgwADDMYZH9Ls66AAAAABJRU5ErkJggg==') 40px 0 no-repeat;margin:-18px 0 0 -44px;padding:1.563em 0 0 80px;height:auto}ol.tree li input:checked+ol>li{display:block;margin:0 0 .125em}ol.tree li input:checked+ol>li:last-child{margin:0 0 .063em}
  </style>
  <title>FED-doc</title>
</head>
<body>

  <div id="sidebar" class="interface">
    <a href="#" class="toc_title">FED-doc</a>
    <% makeTree(data) %>
  </div>

  <div class="container">
    <% makeContent(data) %>
  </div>

</body>
</html>
